package com.distribute.framework.config;

import java.lang.reflect.Field;
import com.distribute.framework.core.lang.source;

public class DatabaseNames {
	public final static String distribute_sys="distribute_sys";
	public final static String distribute_sys_redis="redis.framework";
	public final static String distribute_sys_broker="framework";
	public final static String distribute_data="distribute_data";
	public final static String distribute_data_redis="redis.framework";
	public final static String distribute_data_broker="framework";
	
	public static String get(Class modelClass,String type){
		source source = (source) modelClass.getAnnotation(source.class);
		if(source==null)return null;
		try {
			Field field = DatabaseNames.class.getDeclaredField(source.value()+"_"+type);
			if(field==null)return null;
			field.setAccessible(true);
			return (String) field.get(null);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}
	
}